package com.imtimmy.android.pda;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public final class DatabaseHelper extends SQLiteOpenHelper {
	public static final String DATABASE_NAME = "pda.db";
	public static final int DATABASE_VERSION = 2;
	public static final String TABLE_NAME = "pda";

	public static final String COLUMN_ID = "id";
	public static final String COLUMN_DATE = "date";
	public static final String COLUMN_TITLE = "title";
	public static final String COLUMN_CONTENT = "content";
	public static final String COLUMN_IMAGE = "image_path";
	public static final String COLUMN_SOUND = "sound_path";
	public static final String COLUMN_COLOR = "color";

	DatabaseHelper(Context paramContext) {
		super(paramContext, DATABASE_NAME, null, DATABASE_VERSION);
	}

	public void onCreate(SQLiteDatabase paramSQLiteDatabase) {
		paramSQLiteDatabase
				.execSQL("CREATE TABLE "
						+ TABLE_NAME
						+ " (id INT PRIMARY KEY, date TIMESTAMP, title VARCHAR(100), content VARCHAR(100), image_path VARCHAR(100), sound_path VARCHAR(100), color INT)");
	}

	public void onUpgrade(SQLiteDatabase paramSQLiteDatabase, int paramInt1,
			int paramInt2) {
		paramSQLiteDatabase.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
		onCreate(paramSQLiteDatabase);
	}
}